#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;
const int N = 1e5 + 10;

int n;
int q[N];
/*
对于一个数组a求一个数组b 使得 sum(ai * bi) = 0   长度为n
1、当n为偶数时
    可以两两分组因为对于任意的ai，ai+1 都有 -ai+1， ai 使得 ai*ai+1 - ai+1*ai = 0
    和为 MAXV * MAXN
2、当n为奇数时
可以拆出三个元素，使得这三个元素的和为0，然后剩下的元素按照第一种方法，剩下元素的最大和 sum1 <= (MAXN - 4)* MAXV
定理：如果三个数都不为零，则必然存在两个数相加不为0
对于任意三个数x, y, z, 假设 x + y ！= 0
则可以使 a = z, b = z, c = -(x + y)使得 ax + by + cz = 0
最大和为 sum1 + MAXV * 4 <= MAXV * MAXN
*/

void solve(){
    cin >> n;
    for(int i = 1; i <= n; i ++){
        cin >> q[i];
    }

    if(n % 2){
        for(int i = 1; i <= n - 3; i += 2){
            cout << q[i + 1] << " " << -q[i] << " ";
        }

        int a = q[n - 2], b = q[n - 1], c = q[n];

        if(a + b){
            cout << c << " " << c << " " << -(a + b);
        }else if(b + c){
            cout << -(b + c) << " " << a << " " << a;
        }else{ // a + c
            cout << b << " " << -(a + c) << " " << b;
        }


    }else{
        for(int i = 1; i <= n; i += 2){
            cout << q[i + 1] << " " << -q[i] << " ";
        }
    }

    cout << '\n';
}

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;
    cin >> T;

    while(T--){
        solve();
    }

    return 0;
}